package com.xbj.voa.controller;

import com.xbj.voa.common.utils.R;
import com.xbj.voa.controller.form.TestForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author: 木火
 * @create: 2024-01-02
 * @description:
 **/
@RestController
@RequestMapping("/test")
@Api("测试web接口")
public class TestController {
    @GetMapping("/sayHello")
    @ApiOperation("测试swagger")
    public R sayHello(){
        return R.ok().put("message","ok");
    }

    @PostMapping("/testValidation")
    @ApiOperation("测试验证功能-Validation")
    public R testValidation(@Valid @RequestBody TestForm testForm){
        return R.ok().put("message","hello "+testForm.getName());
    }





}
